<template>
  <div class="article" v-loading="dataListLoading">
    <h1 class="title">{{ title }}</h1>
    <article v-html="content"></article>
  </div>
</template>

<script>
import { getArticleInfo } from '@api/admin'

export default {
  name: 'ArticlePage',
  data() {
    return {
      dataListLoading: true,
      content: '',
      title: ''
    }
  },
  activated() {
    this.dataListLoading = true
    const id = this.$route.query.id
    if (id) this.init(id)
    else this.$router.push({name:'home'})
  },
  methods: {
    init(id) {
      getArticleInfo(id).then(res => {
        if (res.data.code == 0) {
          const { content, title } = res.data.epidemicInformation
          this.content = content
          this.title = title
          setTimeout(() => {
            this.dataListLoading = false
          }, 300)
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.article {
}
</style>
